package hdfs_pro;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class ReadFile {
    public static void main(String[] args) {
        try {
              Configuration conf = new Configuration();
              FileSystem fs = FileSystem.get(conf);
              String filePath = args[0];
              Path srcPath = new Path(filePath);
            
              FSDataInputStream is = fs.open(srcPath);
              while(true) {
                    String line = is.readLine();
                    if(line == null) {
                          break;
                    }
                    System.out.println(line);
            }
                is.close();
        }catch(Exception e) {
            e.printStackTrace();
        }
    }
}